define(['app'],function(app) {
	return {module: function($scope, $http, eventBusService, httpService, params, configService) {
		$scope.form = {};
        $scope.form.father_id = 'ROOT';
        $scope.form.fk_client = params.fk_client;

        httpService.post(app.urls.rule_selectIcon,{},function(data){
    		if("0000" === data.code){
    			$scope.icons = data.data;
    		}else{
    			alert(data.msg);
    		}
    	});        
    	//保存
    	$scope.save = function() {
    		if(!$scope.formCheck()) {
                return;
            }

            $scope.form.is_leaf = '1';
			httpService.post(app.urls.menu_insert, $scope.form, function(data) {
    			if(data.code == "0000") {
    			     eventBusService.publish("modal.page.close",{});
                     eventBusService.publish("content.page.reload", data.data);
    			}else{
    				eventBusService.publish("modal.alert", {"content":data.msg});
    			}
            });
        };
	}
}});
